import java.util.*;

public class Main {
    // 微信红包
    public static int getValue(int[] gifts, int n) {
        // write code here
        Map<Integer, Integer> map = new HashMap<>();
        for (int gift : gifts) {
            if (!map.containsKey(gift)) {
                map.put(gift, 1);
            } else {
                map.put(gift, map.get(gift) + 1);
            }
            if (map.get(gift) > n / 2) {
                return gift;
            }
        }
        return 0;
    }

    public static void main3(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] arr = {1,1,2,2,3,3};
        System.out.println(getValue(arr, 6));
    }



    // 找出字符串中第一个只出现一次的字符
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            if (!map.containsKey(str.charAt(i))) {
                map.put(str.charAt(i), 1);
            } else {
                map.put(str.charAt(i), map.get(str.charAt(i))+1);
            }
        }
        for (int i = 0; i < str.length(); i++) {
            if (map.get(str.charAt(i)) == 1) {
                System.out.println(str.charAt(i));
                return;
            }
        }
        System.out.println(-1);
    }

    //  小易的升级之路
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int a = in.nextInt();
            for (int i = 0; i < n; i++) {
                int m = in.nextInt();
                if (a >= m) {
                    a += m;
                } else {
                    a += gCD(a, m);
                }
            }
            System.out.println(a);
        }
    }

    private static int gCD(int a, int b) {
        for (int i = a; i >= 0; i--) {
            if (a % i == 0 && b % i == 0) {
                return i;
            }
        }
        return -1;
    }
}
